package com.hgyc.mom.eam.entity;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.*;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.hgyc.mom.common.annotation.Excel;
import com.hgyc.mom.core.annotation.DictColumn;
import com.hgyc.mom.core.annotation.TableDict;
import com.hgyc.mom.core.mybatis.EQ;
import com.hgyc.mom.core.mybatis.Like;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

/**
 * <p>
 * 设备维修单
 * </p>
 *
 * @author fwj
 * @since 2025-08-18
 */
@Data
@TableName("eam_equipment_repair")
@Schema(name="设备维修单对象", description="设备维修单对象")
public class EamEquipmentRepair implements Serializable {
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Schema(description = "计划ID")
    private Long id;

    @Excel(name = "维修单号")
    @EQ
    @Schema(description = "维修单号")
    private String code;

    @Excel(name = "关联单据")
    @Schema(description = "关联单据")
    private String relateCode;

    @Excel(name = "设备ID")
    @EQ
    @Schema(description = "设备ID")
    @TableDict(table="eam_equipment", key = "id", columns = {
            @DictColumn(name = "code", alias = "equipmentCode"),
            @DictColumn(name = "name", alias = "equipmentName"),
            @DictColumn(name="model", alias = "equipmentModel"),
            @DictColumn(name="use_status", alias = "equipmentStatus")
    })
    private Long equipmentId;

    @Excel(name = "设备类型")
    @Schema(description = "设备类型")
    @TableDict(table = "eam_equipment_type", key = "id" , columns = {
            @DictColumn(name ="name", alias = "equipmentTypeName"),
    })
    private Long equipmentType;

    @Excel(name = "设备负责人")
    @Schema(description = "设备负责人")
    @TableDict(table = "sys_user", key = "id", columns = {
            @DictColumn(name = "name", alias = "resourceOwnerName")
    })
    private Long resourceOwner;

    @Excel(name = "车间")
    @Schema(description = "车间")
    @TableDict(table = "mes_workshop", key = "id" , columns = {
            @DictColumn(name ="name", alias = "workshopName"),
    })
    private Long workshopId;

    @Excel(name = "维修状态")
    @EQ
    @Schema(description = "维修状态")
    private String repairStatus;

    @Excel(name = "紧急状态")
    @EQ
    @Schema(description = "紧急状态")
    private String urgency;

    @Excel(name = "报修时间")
    @Schema(description = "报修时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime requestTime;

    @Excel(name = "报修人")
    @Schema(description = "报修人")
    @TableDict(table = "sys_user", key = "id", columns = {
            @DictColumn(name = "name", alias = "requestUserName")
    })
    private Long requestUser;

    @Excel(name = "送修方式")
    @Schema(description = "送修方式")
    private String repairMode;

    @Excel(name = "预计完成时间")
    @Schema(description = "预计完成时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate estimatedWorkOrderTime;

    @Excel(name = "维修开始时间")
    @Schema(description = "维修开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime repairStartTime;

    @Excel(name = "维修结束时间")
    @Schema(description = "维修结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime repairFinishTime;

    @Excel(name = "维修责任人")
    @EQ
    @Schema(description = "维修责任人")
    @TableDict(table = "sys_user", key = "id", columns = {
            @DictColumn(name = "name", alias = "repairOwnerName")
    })
    private Long repairOwner;

    @Excel(name = "维修结果")
    @EQ
    @Schema(description = "维修结果")
    private String repairResult;

    @Excel(name = "累计暂停时长/h")
    @Schema(description = "累计暂停时长/h")
    private BigDecimal suspendTime;

    @Excel(name = "执行人")
    @Schema(description = "执行人")
    @TableDict(table = "sys_user", key = "id", columns = {
            @DictColumn(name = "name", alias = "executorName")
    })
    private Long executor;

    @Excel(name = "故障描述")
    @Schema(description = "故障描述")
    private String symptoms;

    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "创建者")
    private Long createBy;

    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.UPDATE)
    @Schema(description = "更新者")
    private Long updateBy;

    @TableField(fill = FieldFill.UPDATE)
    @Schema(description = "更新时间")
    private LocalDateTime updateTime;

}
